package cn.gdut.chengcai.enums;

/**
 * 上传文件的类型
 */
public enum UploadFileType {
	UNKNOWNED(0), // 未知
	DOWNLOAD_AREA(1), // 下载专区
	PROFILE(11), // 简介：个人照片、身份证照片、营业执照
	VOUCHER(12), // 支付凭证
	IMG(13), // 图片：头像、其他类型的图片
	COURSEWARE(14), // 课件
	APPLY(21), // 申请材料
	SYSTEM_FILE(99); // 系统文件

	private int value;

	private UploadFileType(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public static String getString(Integer value) {
		String result = "未知";
		if (value == UploadFileType.DOWNLOAD_AREA.getValue()) {
			result = "下载专区";
		} else if (value == UploadFileType.PROFILE.getValue()) {
			result = "简介";
		} else if (value == UploadFileType.VOUCHER.getValue()) {
			result = "支付凭证";
		} else if (value == UploadFileType.IMG.getValue()) {
			result = "图片";
		} else if (value == UploadFileType.SYSTEM_FILE.getValue()) {
			result = "系统文件";
		} else if (value == UploadFileType.COURSEWARE.getValue()) {
			result = "课件";
		} else if (value == UploadFileType.APPLY.getValue()) {
			result = "申请材料";
		}
		return result;
	}

	public static Integer getInteger(String value) {
		Integer result = null;
		if (value.equals("未知")) {
			result = UploadFileType.UNKNOWNED.getValue();
		} else if (value.equals("下载专区")) {
			result = UploadFileType.DOWNLOAD_AREA.getValue();
		} else if (value.equals("简介")) {
			result = UploadFileType.PROFILE.getValue();
		} else if (value.equals("支付凭证")) {
			result = UploadFileType.VOUCHER.getValue();
		} else if (value.equals("图片")) {
			result = UploadFileType.IMG.getValue();
		} else if (value.equals("系统文件")) {
			result = UploadFileType.SYSTEM_FILE.getValue();
		} else if (value.equals("课件")) {
			result = UploadFileType.COURSEWARE.getValue();
		} else if (value.equals("申请材料")) {
			result = UploadFileType.APPLY.getValue();
		}
		return result;
	}
}